<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>开关按钮</title>
    <style>
        .s{
            position: relative;
            display: block;
            margin-bottom: 10px;
        }
        .s input{
            display: none;
        }
        .s1{
             width: 100px;
             height: 40px;
             background-color: #ccc;
             display: block;
             overflow: hidden;
             cursor: pointer;
             transition: 0.4s;
         }
        .s1:before{
            position: absolute;
            width: 32px;
            content: '';
            height: 32px;
            left: 4px;
            bottom: 4px;
            background-color: #fff;
            transition: 0.2s;
        }
        .s input:checked + .s1{
            background-color: #03a9f4;
        }
        .s input:checked + .s1:before{
            left: 64px;
        }
        .s2{
            width: 100px;
            height: 40px;
            background-color: #ccc;
            display: block;
            overflow: hidden;
            cursor: pointer;
            transition: 0.4s;
            border-radius: 20px;
        }
        .s2:before{
            width: 32px;
            position: absolute;
            content: '';
            height: 32px;
            left: 4px;
            bottom: 4px;
            background-color: #fff;
            border-radius: 50%;
            transition: 0.2s;
        }
        .s input:checked + .s2{
            background-color: #03a9f4;
        }
        .s input:checked + .s2:before{
            left: 64px;
        }
    </style>
</head>
<body>
<label class="s">
    <input type="checkbox">
    <span class="s1"></span>
</label>
<label class="s">
    <input type="checkbox">
    <span class="s2"></span>
</label>
</body>
<script src="jquery-3.3.1.min.js"></script>
<script>

</script>
</html>